[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
MID(SEXP,IEXP1,IEXP2) (STRING)
Function
Get any sub string of a string.
Syntax
MID(str,pos,chars)
str = A string expression to take the left most characters of.
pos = An integer expression with the position within str to start
taking the sub string from.
chars = An integer expression with the number of characters to take
from str.
Return Type & Value
STRING
Returns a string with the specified number of characters from the
specified position of str.
Remarks
This function will return a sub string with the specified number of
characters and from the specified position of str. This can be useful
in data processing as well as text formatting. The pos parameter may be
less than 1 (the beginning of the str) and greater than the length of
str; if it is then spaces will be added to the beginning and/or ending
as needed. If chars is less than or equal to 0 then the returned string
will be empty. If chars is greater than the available length of str then
the returned string will have spaces added to the end(s) to pad it out to
the full length specified.
Examples
WHILE (RANDOM(250) <> 0) PRINT MID(RANDOM(250),0,4)," "
STRING s
FOPEN 1,"DATA.TXT",O_RD,S_DN
WHILE (!FERR(1)) DO
FGET 1,s
PRINT LEFT(s,5),RTRIM(MID(s,5,20)," ")," - "
PRINTLN RTRIM(MID(s,LEN(s)-25,60)," ")
ENDWHILE
FCLOSE 1
See Also:
LEFT()
RIGHT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson